using System.Diagnostics;


namespace WtfManager.EditingHistory
{
  public abstract class Change
  {
    #region Properties/Indexers


    public abstract string Details
    {
      get;
    }

    public abstract string Name
    {
      get;
    }


    #endregion


    #region Methods


    internal void Do()
    {
      try
      {
        Execute();
      }
      catch
      {
        Debug.Fail("Failed to execute '" + Name + "' change.");
        return;
      }
    }


    internal void Undo()
    {
      try
      {
        Revert();
      }
      catch
      {
        Debug.Fail("Failed to undo '" + Name + "' change.");
      }
    }


    protected abstract void Execute();
    protected abstract void Revert();


    #endregion
  }
}